package org.shilong.MLogic.Json.businesscard;

import java.util.LinkedList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.shilong.Model.BusinessCardModel;

/**
 * 将名片信息json转换成list
 * @author Administrator
 *
 */
public class GetBusinessCardLogic {


	private static JSONObject jObject = null;

	private static JSONArray jArr = null;


	private static LinkedList<BusinessCardModel> mList = null;

	public static LinkedList<BusinessCardModel> getRlt( Object req ){

		jObject = null;

		mList = null;

		jArr = null;
		
		
		mList = new LinkedList<BusinessCardModel>();
		try {
			jObject = new JSONObject( (String)req );
			
			jArr = jObject.getJSONArray( "rlt" );
			
			for( int i = 0; i < jArr.length(); i++ ){

				JSONObject oo = jArr.getJSONObject( i );

				BusinessCardModel bean = new BusinessCardModel();

				bean.setAge( oo.getString( "age" ));
				bean.setBussiness( oo.getString( "bussiness" ));
				bean.setCompany_name(oo.getString( "company_name" ));
				bean.setDomain(oo.getString( "domain" ));
				bean.setSex(oo.getString( "sex" ));
				bean.setTelephone_number(oo.getString( "telephone_number" ));
				
				mList.add(bean);
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return mList;
	}
}
